/*dymC5ElqxCTZpiFuHTRJcge9lUvN2/0C9ZV86odhhzGCi+tSk3SdKg81eIv1vfLD*/
/*
 * @Author: llixxm
 * @Date: 2020-05-06 11:38:04
 * @Description: 外币折算组件
 */
import React, { Component } from 'react';
import {base} from 'nc-lightapp-front'
import ReferLoader from '../../../public/ReferLoader/index.js';
import {currtypeGridRefCode} from '../../../public/ReferLoader/constants.js';
const { NCRow, NCCol, NCNumber } = base;
const userstyle = {marginLeft: '20px'}
class ForeignCurrTrans extends Component { 
    constructor(props) {
        super(props);
        this.state = {

        }
    }
    static defaultProps = {
        labelname: '外币折算', // 悬浮是否显示提示信息,默认true:显示
        attrcode: 'ceshi',
        disabled: false
    };
    onChange = (attrcode, val) => {
        this.props.onChange(attrcode, val)
    }
    renderRefer = (attrcode) => {
        return(
            <div className="book-ref">
                <ReferLoader
                    tag = {attrcode}
                    fieldid = {attrcode}
                    refcode = {currtypeGridRefCode}
                    value = {this.props[attrcode]}
                    isShowDisabledData = {true}
                    isHasDisabledData = {true} //是否有【显示停用】功能
                    queryCondition = {() =>{
                        return {};
                    }}
                    onChange={(v)=>{
                        this.onChange(attrcode, v)
                        // onChangeCallBack && onChangeCallBack();
                    }}
                />
            </div>
        )
    }
    renderNCNumber = (attrcode) => {
        let { fccurrtype, json } = this.props
        let disabled = fccurrtype && fccurrtype.refpk ? false : true; //折算币种为空，则汇率条件置灰，不能录入值
        return(
            <NCNumber 
                fieldid={attrcode}
                max={1000000}
                scale={8}
                disabled = {disabled}
                placeholder={json['childmodules-000013']} /* 国际化处理： 请输入汇率*/
                value={this.props[attrcode]}
                onChange = {(v)=>{this.onChange(attrcode, v)}}
            />
        )
    }
    render() {
        let {json} = this.props;
        return (
            <NCRow className="myrow">
                <NCCol md={2} sm={2}>
                    <span className='nc-theme-form-label-c'>{json['childmodules-000011']}：</span>{/* 国际化处理： 折算币种*/} 
                </NCCol>
                <NCCol md={4} sm={4}>
                    <div className="book-ref">
                        {this.renderRefer('fccurrtype')}
                    </div>
                </NCCol>
                <NCCol md={2} sm={2}>
                    <div style={userstyle}>
                        <span className='nc-theme-form-label-c'>{json['childmodules-000012']}：</span>{/* 国际化处理： 折算币种*/} 
                    </div>
                </NCCol>
                <NCCol md={4} sm={4}>
                    {this.renderNCNumber('fcrate')}
                </NCCol>
            </NCRow>
        )
    }
}

export default ForeignCurrTrans
/*dymC5ElqxCTZpiFuHTRJcge9lUvN2/0C9ZV86odhhzGCi+tSk3SdKg81eIv1vfLD*/